package nothing.model;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.appfuse.model.BaseObject;
import org.appfuse.model.User;

@Entity
@Table(name = "step")
public class Step extends BaseObject {

    private Long id;
    private int step;
    private String description;
    private String note;
    private int time;
    private int difficulty;
    private User user;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false, insertable = true, updatable = true)
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Column(name = "step", length = 2)
    public int getStep() {
        return step;
    }

    public void setStep(int step) {
        this.step = step;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "description", length = 500)
    public String getDescription() {
        return description;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @Column(name = "note", length = 5000)
    public String getNote() {
        return note;
    }

    public void setTime(int time) {
        this.time = time;
    }

    @Column(name = "time", length = 5)
    public int getTime() {
        return time;
    }

    public void setDifficulty(int difficulty) {
        this.difficulty = difficulty;
    }

    @Column(name = "difficulty", length = 1)
    public int getDifficulty() {
        return difficulty;
    }

    public String toString() {
        return "RecipeStep{" +
                "id=" + id +
                "description=" + description +
                "Note=" + note +
                "time=" + time +
                "difficulty=" + difficulty +
                "}";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Step other = (Step) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.step != other.step) {
            return false;
        }
        if (this.description != other.description && (this.description == null || !this.description.equals(other.description))) {
            return false;
        }
        if (this.note != other.note && (this.note == null || !this.note.equals(other.note))) {
            return false;
        }
        if (this.time != other.time) {
            return false;
        }
        if (this.difficulty != other.difficulty) {
            return false;
        }
        if (this.user != other.user && (this.user == null || !this.user.equals(other.user))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 41 * hash + this.step;
        hash = 41 * hash + (this.description != null ? this.description.hashCode() : 0);
        hash = 41 * hash + (this.note != null ? this.note.hashCode() : 0);
        hash = 41 * hash + this.time;
        hash = 41 * hash + this.difficulty;
        hash = 41 * hash + (this.user != null ? this.user.hashCode() : 0);
        return hash;
    }

}
